package demo2;


public class Genericity {
    public static void main(String[] args) {

    }
    public static void main1(String[] args) {
        /**
         * 传递String*/

        MyArray<String> myArray = new MyArray<>();

        myArray.put("LinkedList");
        myArray.put("ArrayList");
        myArray.put("BinaryTree");
        myArray.put("Stack");
        myArray.put("Queue");
        myArray.put("PriorityQueue");
        myArray.put("Map");
        myArray.put("Set");
        for(int i = 0; i < myArray.usedSize; i++) {
            System.out.println(myArray.getPos(i));
        }
        /**
         * 传递Integer*/
        MyArray<Integer> myArray1=  new MyArray<>();
        myArray1.put(1);
        myArray1.put(2);
        myArray1.put(3);
        myArray1.put(4);
        myArray1.put(4);
        myArray1.put(6);
        for(int i = 0; i < myArray1.usedSize; i++) {
            System.out.println(myArray1.getPos(i));
        }
    }
}
